<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: index.php 136 2013-09-22 07:38:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 136 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:38:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright © since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	© 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	© 2002-2003 osCommerce - www.oscommerce.com
* 	© 2003     nextcommerce - www.nextcommerce.org
* 	© 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

require('../includes/configure.php');

if(isset($_POST['DB_SERVER'])) {
	$data = array();
	$data['DB_SERVER'] = trim(stripslashes($_POST['DB_SERVER']));
	$data['DB_SERVER_USERNAME'] = trim(stripslashes($_POST['DB_SERVER_USERNAME']));
	$data['DB_SERVER_PASSWORD'] = trim(stripslashes($_POST['DB_SERVER_PASSWORD']));
	$data['DB_DATABASE'] = trim(stripslashes($_POST['DB_DATABASE']));
	$data['DB_TYPE'] = trim(stripslashes($_POST['DB_TYPE']));
	$data['DB_PREFIX'] = trim(str_replace('-', '', (strtolower($_POST['DB_PREFIX']))));

	define('DB_SERVER', trim(stripslashes($_POST['DB_SERVER'])));
	define('DB_SERVER_USERNAME', trim(stripslashes($_POST['DB_SERVER_USERNAME'])));
	define('DB_SERVER_PASSWORD', trim(stripslashes($_POST['DB_SERVER_PASSWORD'])));
	define('DB_DATABASE', trim(stripslashes($_POST['DB_DATABASE'])));
	define('DB_TYPE', trim(stripslashes($_POST['DB_TYPE'])));
	define('DB_PREFIX', trim(str_replace('-', '', (strtolower($_POST['DB_PREFIX'])))));
}

require('includes/application.php');
	
if(defined('MERCARI_INSTALLED')) {
	if(!isset($_SESSION['valid_install'])) {
		header('Location: ../');
		exit;
	}
}

if(!isset($_GET['step']))
	$_GET['step'] = 0;
	
define('VALID_INSTALLER', time());

switch($_GET['step']) {
	case '0':
		include('includes/install_step_0.php');
		break;

	case '1':
		include('includes/install_step_1.php'); // Schreiben der Konfigdateien
		break;
	
	case '2':
		include('includes/install_step_2.php'); // Installation der SQL-Dateien
		break;
	
	case '3':
		include('includes/install_step_3.php'); // Admindaten abfragen
		break;
	
	case '4':
		include('includes/install_step_4.php'); // Kundengruppen einstellen
		break;
		
	case 'finished':
		include('includes/install_finished.php'); // Feddich ;-)
		break;
}
?>